﻿<%@ Page Title="" Language="C#" MasterPageFile="~/app-frame.master" AutoEventWireup="true" CodeFile="mailmerge.aspx.cs" Inherits="mailmerge" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder3" Runat="Server">
    <script type="text/javascript" src="scripts/mailmerge.js" language="javascript"></script>
    <table style="width: 100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td><asp:Label ID="lblMessage" runat="server" CssClass="defaultFont" Font-Size="X-Small" ForeColor="Black"></asp:Label></td>
            <td colspan="4" style="width:1%"></td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="upConfirm" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="pnl_confirm" runat="server" Visible="false">
                            <div class="mbMessage">
                                <table border="0" cellpadding="0" cellspacing="2">
                                    <tr>                                                                
                                        <td valign="middle">
                                            <asp:Label CssClass="controlFont" ID="lbl_confirmMsg" runat="server" Text="<img alt='Information' src='images/info.gif' />&nbsp;The emails will be processed now to be delivered date. Continue?"></asp:Label>
                                        </td>
                                        <td>
                                            &nbsp;&nbsp;<asp:Button ID="btnYes" runat="server" Text="Yes" OnClick="btnYes_Click" />
                                        </td>
                                        <td>
                                            <asp:Button ID="btnNo" runat="server" Text="No" OnClientClick="javascript:disableConfirmMsg(); return false;" OnClick="btnNo_Click" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnNo" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="btnYes" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="btnNo1" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="btnYes1" EventName="Click" />
                        <%--<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />--%>
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td style="height:30px;">
                <table style="width: 100%" class="Dynamic_PageHeaderRow">
                <tr>
                    <td width="33%" align="left">
                        <asp:Label ID="lblHeader" runat="server" Text="Mail Merge - Add"></asp:Label>
                    </td>
                    <td id="addButtons" width="33%" nowrap="nowrap" align="center" style="padding-left:0px">
                        <asp:Button ID="btnSave_top" runat="server" OnClick="btnSave_Click"  Text="Save" OnClientClick="javascript:disableThis('ctl00_ContentPlaceHolder3_btnSave','Saving....');disableThis('ctl00_ContentPlaceHolder3_btnSave_top','Saving....');" />
                        <asp:Button ID="btnUpdate_top" runat="server" OnClick="btnUpdate_Click" Text="Save" Visible="false" OnClientClick="javascript:disableThis('ctl00_ContentPlaceHolder3_btnUpdate','Saving....');disableThis('ctl00_ContentPlaceHolder3_btnUpdate_top','Saving....');" />
                        <asp:Button ID="btnReset_top" runat="server" Text="Reset" UseSubmitBehavior="false" CausesValidation="false" OnClick="btnReset_Click"  />
                        <asp:Label ID="lblViewButton" runat="server" Text=""></asp:Label>
                    </td>
                    <td width="33%" align="right">
                        <asp:Label ID="lblPrintButton" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td id="td_Page_ToopTip" runat="server"></td>
        </tr>
    </table>
    <table id="TABLE1" style="width: 100%" cellpadding="0" cellspacing="0" border="0" runat="server">
    <tr>
    <td>
    <table style="width: 100%" cellpadding="2" cellspacing="2" border="0">
        <tr class="Dynamic_HtmlTableCell">
            <td style="width:20%">
                <asp:Label ID="lbl_p_Mail_Merge_Name" runat="server" CssClass="controlLabelFont" Text="Name"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:TextBox ID="p_Mail_Merge_Name" runat="server" CssClass="controlFont controlWidth" type="text" maxlength="100"></asp:TextBox>
                    <img alt="Required Field" src="Images/star.gif"/>
                    <asp:RequiredFieldValidator ID="rfv_p_Mail_Merge_Name" runat="server" ErrorMessage="This is a requied field." Display="None" ControlToValidate="p_Mail_Merge_Name" />
                    <cc1:ValidatorCalloutExtender ID="vce_p_Mail_Merge_Name" runat="server" TargetControlID="rfv_p_Mail_Merge_Name" WarningIconImageUrl="Images/warning_small.gif" HighlightCssClass="maskInvalid" />
            </td>
            <td style="width:20%">
                <asp:Label ID="lbl_p_Mail_Merge_Description" runat="server" CssClass="controlLabelFont" Text="Description"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:TextBox ID="p_Mail_Merge_Description" runat="server" Rows="3" TextMode="MultiLine" CssClass="controlFont controlWidth" type="text" maxlength="100"></asp:TextBox>
            </td>
        </tr>
        <tr class="Dynamic_HtmlTableCell">
            <td style="width:20%">
                <asp:Label ID="lbl_p_Mail_Merge_Source_ID" runat="server" CssClass="controlLabelFont" Text="Source Table/Query"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:DropDownList ID="p_Mail_Merge_Source_ID" runat="server" onchange="javascript:setEmailFieldFromSource(this);" CssClass="controlFont" type="text" Width="175px" maxlength="100"></asp:DropDownList>
                    <img alt="Required Field" src="Images/star.gif"/>
                    <asp:RequiredFieldValidator ID="rfv_p_Mail_Merge_Source_ID" runat="server" ErrorMessage="This is a requied field." Display="None" ControlToValidate="p_Mail_Merge_Source_ID" />
                    <cc1:ValidatorCalloutExtender ID="vce_p_Mail_Merge_Source_ID" runat="server" TargetControlID="rfv_p_Mail_Merge_Source_ID" WarningIconImageUrl="Images/warning_small.gif" HighlightCssClass="maskInvalid" />
            </td>
            <td style="width:20%">
                <asp:Label ID="lbl_p_Mail_Merge_Email_Template" runat="server" CssClass="controlLabelFont" Text="Email Template"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:DropDownList ID="p_Mail_Merge_Email_Template" runat="server" CssClass="controlFont" type="text" Width="175px" maxlength="100"></asp:DropDownList>
                    <img alt="Required Field" src="Images/star.gif"/>
                    <asp:RequiredFieldValidator ID="rfv_p_Mail_Merge_Email_Template" runat="server" ErrorMessage="This is a requied field." Display="None" ControlToValidate="p_Mail_Merge_Email_Template" />
                    <cc1:ValidatorCalloutExtender ID="vce_p_Mail_Merge_Email_Template" runat="server" TargetControlID="rfv_p_Mail_Merge_Email_Template" WarningIconImageUrl="Images/warning_small.gif" HighlightCssClass="maskInvalid" />
            </td>
        </tr>
        <tr class="Dynamic_HtmlTableCell">
            <td style="width:20%">
                <asp:Label ID="lbl_p_Mail_Merge_From_Mail" runat="server" CssClass="controlLabelFont" Text="From Mail ID"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:TextBox ID="p_Mail_Merge_From_Mail" runat="server" CssClass="controlFont controlWidth" type="text" maxlength="100"></asp:TextBox>
                    <img alt="Required Field" src="Images/star.gif"/>
                    <asp:RequiredFieldValidator ID="rfv_p_Mail_Merge_From_Mail" runat="server" ErrorMessage="This is a requied field." Display="None" ControlToValidate="p_Mail_Merge_From_Mail" />
                    <cc1:ValidatorCalloutExtender ID="vce_p_Mail_Merge_From_Mail" runat="server" TargetControlID="rfv_p_Mail_Merge_From_Mail" WarningIconImageUrl="Images/warning_small.gif" HighlightCssClass="maskInvalid" />
            </td>
            <td style="width:20%">
                <asp:Label ID="lbl_p_Mail_Merge_Delivery_Date" runat="server" CssClass="controlLabelFont" Text="Mail Delivery Date"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:TextBox ID="p_Mail_Merge_Delivery_Date" runat="server" CssClass="controlFont controlWidth" type="text" maxlength="100"></asp:TextBox>
                    <cc1:CalendarExtender ID="Cal2" TargetControlID="p_Mail_Merge_Delivery_Date" CssClass="custom-calendar" runat="server"></cc1:CalendarExtender>
                    <img alt="Required Field" src="Images/star.gif"/>
                    <asp:RequiredFieldValidator ID="rfv_p_Mail_Merge_Delivery_Date" runat="server" ErrorMessage="This is a requied field." Display="None" ControlToValidate="p_Mail_Merge_Delivery_Date" />
                    <cc1:ValidatorCalloutExtender ID="vce_p_Mail_Merge_Delivery_Date" runat="server" TargetControlID="rfv_p_Mail_Merge_Delivery_Date" WarningIconImageUrl="Images/warning_small.gif" HighlightCssClass="maskInvalid" />
            </td>
        </tr>
        <tr class="Dynamic_HtmlTableCell">
            <td style="width:20%">
                <asp:Label ID="lbl_p_Mail_Merge_To_Mail" runat="server" CssClass="controlLabelFont" Text="To Mail ID"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:TextBox ID="p_Mail_Merge_To_Mail" runat="server" CssClass="controlFont controlWidth" type="text" maxlength="100"></asp:TextBox>
                    <img alt="Required Field" src="Images/star.gif"/>
                    <asp:RequiredFieldValidator ID="rfv_p_Mail_Merge_To_Mail" runat="server" ErrorMessage="This is a requied field." Display="None" ControlToValidate="p_Mail_Merge_To_Mail" />
                    <cc1:ValidatorCalloutExtender ID="vce_p_Mail_Merge_To_Mail" runat="server" TargetControlID="rfv_p_Mail_Merge_To_Mail" WarningIconImageUrl="Images/warning_small.gif" HighlightCssClass="maskInvalid" />
            </td>
            
            <td style="width:20%">
                <asp:Label ID="lbl_owner_id" runat="server" CssClass="controlLabelFont" Text="Owner"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:TextBox ID="txt_p_mail_owner_id" runat="server" CssClass="controlFont"></asp:TextBox>
                <asp:HiddenField ID="p_mail_owner_id" runat="server" />
                <img id="imgOwnerSearch" runat="server" alt="Click here for Lookup Window" src="Images/search.gif" class="SearchPopup" onclick="javascript:openlookupwindow('p_mail_owner_id','txt_p_mail_owner_id','f496930dfe0b690f','','');" />
            </td>
        </tr>
        <tr id="tr_Process_Status" class="Dynamic_HtmlTableCell" runat="server" visible="false">
            <td style="width:20%">
                <asp:Label ID="lbl_process_status" runat="server" CssClass="controlLabelFont" Text="Process Status"></asp:Label><br/>
            </td>
            <td style="width:30%">
                <asp:TextBox ID="p_Mail_Merge_Process_Status" runat="server" CssClass="controlFont controlWidth" type="text" maxlength="100"></asp:TextBox>
            </td>
            <td style="width:20%">
            </td>
            <td style="width:30%">
            </td>
        </tr>
        <tr style="padding-top:5px;">
            <td id="td2" valign="top" align="left" colspan="4">
                <span class="defaultFont" style="font-size: 8pt;">
                    Fields marked with (<img src="Images/star.gif"/>) are required.
                </span>
            </td>
        </tr>
    </table>
    
    <table cellpadding="0" cellspacing="0" style="width: 100%">
        <tr class="Dynamic_PageHeaderRow">
            <td width="33%">
            </td>
            <td id="Td1" width="33%" nowrap="nowrap" align="center" style="padding-left:0px">
                <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click"  Text="Save" OnClientClick="javascript:disableThis('ctl00_ContentPlaceHolder3_btnSave','Saving....');disableThis('ctl00_ContentPlaceHolder3_btnSave_top','Saving....');" />
                <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Save" Visible="false" OnClientClick="javascript:disableThis('ctl00_ContentPlaceHolder3_btnUpdate','Saving....');disableThis('ctl00_ContentPlaceHolder3_btnUpdate_top','Saving....');" />
                <asp:Button ID="btnReset_bottom" runat="server" Text="Reset" UseSubmitBehavior="false" CausesValidation="false" OnClick="btnReset_Click"  />
            </td>
            <td width="33%" align="right"> </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:UpdatePanel ID="upConfirm1" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="pnl_confirm1" runat="server" Visible="false">
                            <div class="mbMessage">
                                <table border="0" cellpadding="0" cellspacing="2">
                                    <tr>
                                        <td valign="middle">
                                            <asp:Label ID="lbl_confirmMsg1" runat="server" CssClass="controlFont" Text="<img alt='Information' src='images/info.gif' />&nbsp;The emails will be processed now to be delivered date. Continue?"></asp:Label>
                                        </td>
                                        <td>
                                            &nbsp;&nbsp;<asp:Button ID="btnYes1" runat="server" OnClick="btnYes_Click" Text="Yes" />
                                        </td>
                                        <td>
                                            <asp:Button ID="btnNo1" runat="server" OnClick="btnNo_Click" OnClientClick="javascript:disableConfirmMsg(); return false;" Text="No" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnNo" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="btnYes" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="btnNo1" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="btnYes1" EventName="Click" />
                        <%--<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />--%>
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
    <table cellpadding="0" cellspacing="0" style="width: 100%">
        <tr><td id="tdDisplayGrid" runat="server" valign="top" align="left" style="width:100%;"></td></tr>
    </table>
    </td>
    <td style="width:1%"></td>
    </tr>
    </table>
        <asp:HiddenField ID="hf_ObjectSQL" runat="server" />
        <asp:HiddenField ID="hfAjaxEmailFieldList" runat="server" />
        
</asp:Content>